package cn.xiaohuodui.rest;

import cn.xiaohuodui.exceptions.BussException;
import cn.xiaohuodui.model.Category;
import cn.xiaohuodui.res.JsonRes;
import cn.xiaohuodui.service.CategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Created by TR on 2018/3/30.
 */
@RestController
@RequestMapping("/wx/catalog")
public class CatalogApi {


    @Autowired
    CategoryService categoryService;



    @RequestMapping("index")
    public JsonRes<Map<String, Object>> index() throws BussException {

       return categoryService.getCateData(null);
    }

    /**
     * 这里的参数id是一级目录的id。
     */
    @RequestMapping("current")
    public JsonRes<Map<String, Object>> current(@RequestParam("id") Integer id) throws BussException {

        return categoryService.getCateData(id);
    }

}
